package com.hue.springcloud.controller;

import com.hue.springcloud.Payment;
import com.hue.springcloud.service.PaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class PaymentController {
    @Autowired
    private PaymentService paymentService;

    @GetMapping("/payment/findById/{id}")
    public String findById(@PathVariable("id")long id){
        Payment payment = paymentService.findById(id);
        if (payment!=null){
            return paymentService.findById(id).toString();
        }
        return null;
    }
}
